using System;
using System.Collections.Generic;
using System.Text;

namespace NSimpleDB.Service.Contract
{
    public interface ISimpleDBAttribute
    {
        string Name { get; }
        string Value { get; set; }
    }

    public interface ISimpleDBAttributeToPut : ISimpleDBAttribute
    {
        bool Replace { get; set; }
    }


    [Serializable]
    public class SimpleDBAttribute : ISimpleDBAttributeToPut
    {
        #region fields and ctors
        private string name;
        private string value = "";
        private bool replace = false;

        public SimpleDBAttribute(string name)
        {
            this.name = name;
        }

        public SimpleDBAttribute(string name, string value)
        {
            this.name = name;
            this.value = value;
        }

        public SimpleDBAttribute(string name, string value, bool replace)
        {
            this.name = name;
            this.value = value;
            this.replace = true;
        }
        #endregion

        #region ISimpleDBAttribute Members

        public string Name
        {
            get { return this.name; }
        }

        public string Value
        {
            get
            {
                return this.value;
            }
            set
            {
                this.value = value;
            }
        }

        #endregion

        #region ISimpleDBAttributeToBeWritten Members

        public bool Replace
        {
            get
            {
                return this.replace;
            }
            set
            {
                this.replace = value;
            }
        }

        #endregion

    }
}
